package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.ReceivedPaymentDetailInfoView;

public interface ReceivedPaymentDetailInfoViewRepository extends JpaRepository<ReceivedPaymentDetailInfoView, String> {

	@Query("select p from ReceivedPaymentDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2")
	Page<ReceivedPaymentDetailInfoView> findBySContractIdAndSContractType(String contractId, String contractType,
			Pageable pageable);

	@Query(" select count(*) from ReceivedPaymentDetailInfoView p where p.sContractId = ?1")
	Long getPayRegistCount(String contractId);

	@Query("select p from ReceivedPaymentDetailInfoView p where p.sContractId = ?1 and p.sContractType=?2 and p.sCreateUserId=?3")
	Page<ReceivedPaymentDetailInfoView> findBySContractIdAndSContractTypeAndSCreateUserId(String contractId,
			String contractType, String userId, Pageable pageable);

	@Query(" select count(*) from ReceivedPaymentDetailInfoView p where p.sContractId = ?1 and p.sCreateUserId=?2")
	Long getPayRegistCount(String contractId, String userId);

}
